package com.bolt.report.engine.fill;

import com.bolt.common.reflect.ObjectUtil;
import com.bolt.report.engine.FillElement;
import com.bolt.report.engine.model.Expression;

public abstract class BaseFillElement<R> implements FillElement<R> {

    protected Expression expr;

    protected FillContext fillContext;

    protected R value;

    protected HyperlinkData hyperlinkData;

    @Override
    public R getValue() {
        return value;
    }

    @Override
    public void setValue(R value) {
        this.value = value;
    }


    public Expression getExpr() {
        return expr;
    }

    public void setExpr(Expression expr) {
        this.expr = expr;
    }

    public FillContext getFillContext() {
        return fillContext;
    }

    public void setFillContext(FillContext fillContext) {
        this.fillContext = fillContext;
    }

    @Override
    public HyperlinkData getHyperlinkData() {
        return this.hyperlinkData;
    }

    @Override
    public void setHyperlinkData(HyperlinkData hyperlinkData) {
        this.hyperlinkData = hyperlinkData;
    }

    public boolean haveHyperlink(){
        return ObjectUtil.isNotNull(this.hyperlinkData) && this.hyperlinkData.haveHyperlink();
    }
}